package concurrent;

import org.junit.Test;

/**
 * >> 符号位不参与移动
 * >>> 符号位也跟着移动
 * @author tuyou
 * @date 2020-08-19 22:54:27
 */
public class SimpleTest {

    @Test
    public void test1() {

        int i = 10;

        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
    }

    @Test
    public void test2() {

        int i = 10;

        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
    }


    @Test
    public void test3() {

        int i = -10;

        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
        System.out.println(i >>= 1);
    }

    @Test
    public void test4() {

        int i = -10;

        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
        System.out.println(i >>>= 1);
    }
}
